
#include "Progressbar.h" 

void Download_Simulation(callback_t cb)
{
    double FileSize = 100 * 1.0;  // 文件大小
    double Current = 0.0;                       // 下载进度
    double BandWidth = 1.0;       // 网络带宽

    printf("Download start!\n");
    while (Current <= FileSize)
    {
        cb(FileSize, Current);
        Current += BandWidth;
        usleep(50000);
    }
    printf("\nThe file size is %.2lf MB\nDownload complete!\n", FileSize);
}

int main()
{
    // ForTest();
    // ProsBar();
    Download_Simulation(ProsBar);
    // ProsBar(100.0, 56.9);
    return 0;
}
